<?php
/**
 * 
 */
class System_Security_Controller{
    /**
     * Class Constructor
     *
     * @access public
     * @return null
     */     
    public function __construct(){
        # code...
    }
    
    /**
     * runs a bitwise and check on the two arguments passed in
     *
     * @param integer $argument_1, integer representing the access_level to check against
     * @param integer|boolean $argument_s, integer representing the access_level to check against. If this is not defined, the user access_level as 
     *          defined in the session var will be used
     * @static
     * @return boolean
     */
    public static function andThis($argument_1, $argument_2 = false){
        $result     = false;
        $user_role  = (isset($_SESSION['user']['user_role'])) ? $_SESSION['user']['user_role'] : 0;
        $argument_2 = pick($argument_2, $user_role);
        
        
        if(is_numeric($argument_1) && is_numeric($argument_2)){
            $result = (int) $argument_1 & (int) $argument_2;
        }else{
            throw new System_Security_Exception('Both arguments must be numeric. You passed in: '. $argument_1 .' and '. $argument_2);
        }

        return (bool) $result;
    }    
}